<?php

namespace App\Observers;

use App\Models\Order;
use App\Models\OrderComment;


class OrderCommentObserver
{
    /**
     * Handle the OrderComment "saved" event.
     *
     * @param  \App\Models\OrderComment  $OrderComment
     * @return void
     */
    public function created(OrderComment $OrderComment)
    {
        $order = Order::find($OrderComment->order_id);
        if (!empty($order)) {
            $order->is_eval = 1;
            $order->save();
        }
    }
    /**
     * Handle the OrderComment "saved" event.
     *
     * @param  \App\Models\OrderComment  $OrderComment
     * @return void
     */
    public function updated(OrderComment $OrderComment)
    {
        $order = Order::find($OrderComment->order_id);
        if (!empty($order)) {
            $order->is_eval = 1;
            $order->save();
        }
    }
    /**
     * Handle the OrderComment "saved" event.
     *
     * @param  \App\Models\OrderComment  $OrderComment
     * @return void
     */
    public function saved(OrderComment $OrderComment)
    {
        $order = Order::find($OrderComment->order_id);
        if (!empty($order)) {
            $order->is_eval = 1;
            $order->save();
        }
    }

    /**
     * Handle the OrderComment "deleted" event.
     *
     *@param  \App\Models\OrderComment  $OrderComment
     * @return void
     */
    public function deleted(OrderComment $OrderComment)
    { }
}
